@import '../mdc-helpers/mdc-helpers';
@import '@material/theme/functions.import';
@import '@material/snackbar/variables.import';
@import '@material/snackbar/mixins.import';

@mixin mat-mdc-snack-bar-color($config-or-theme) {
  $config: mat-get-color-config($config-or-theme);

  $orig-mdc-snackbar-fill-color: $mdc-snackbar-fill-color;
  $orig-mdc-snackbar-label-ink-color: $mdc-snackbar-label-ink-color;
  $orig-mdc-snackbar-dismiss-ink-color: $mdc-snackbar-dismiss-ink-color;

  @include mat-using-mdc-theme($config) {
    $mdc-snackbar-fill-color: mix(
      mdc-theme-prop-value(on-surface),
      mdc-theme-prop-value(surface),
      80%
    ) !global;
    $mdc-snackbar-label-ink-color: rgba(
      mdc-theme-prop-value(surface),
      mdc-theme-text-emphasis(high)
    ) !global;
    $mdc-snackbar-dismiss-ink-color: rgba(
      mdc-theme-prop-value(surface),
      mdc-theme-text-emphasis(high)
    ) !global;

    @include mdc-snackbar-core-styles($query: $mat-theme-styles-query);
  }

  $mdc-snackbar-fill-color: $orig-mdc-snackbar-fill-color !global;
  $mdc-snackbar-label-ink-color: $orig-mdc-snackbar-label-ink-color !global;
  $mdc-snackbar-dismiss-ink-color: $orig-mdc-snackbar-dismiss-ink-color !global;
}

@mixin mat-mdc-snack-bar-typography($config-or-theme) {
  $config: mat-get-typography-config($config-or-theme);
  @include mat-using-mdc-typography($config) {
    @include mdc-snackbar-core-styles($query: $mat-typography-styles-query);
  }
}

@mixin mat-mdc-snack-bar-density($config-or-theme) {}

@mixin mat-mdc-snack-bar-theme($theme-or-color-config) {
  $theme: mat-private-legacy-get-theme($theme-or-color-config);
  @include mat-private-check-duplicate-theme-styles($theme, 'mat-mdc-snack-bar') {
    $color: mat-get-color-config($theme);
    $density: mat-get-density-config($theme);
    $typography: mat-get-typography-config($theme);

    @if $color != null {
      @include mat-mdc-snack-bar-color($color);
    }
    @if $density != null {
      @include mat-mdc-snack-bar-density($density);
    }
    @if $typography != null {
      @include mat-mdc-snack-bar-typography($typography);
    }
  }
}

